import Mock from "mockjs";

// 获取 mock.Random 对象
const Random = Mock.Random;
// mock数据
const mockData = function () {
  let dataList = [];
  for (let i = 0; i < 30; i++) {
    let newDataList = {
      name: Random.province().substring(0, 2),
      value: Random.increment(100),
    };
    dataList.push(newDataList);
  }
  return dataList;
};

const mockData1 = function () {
  let dataList = [];
  for (let i = 0; i < 4; i++) {
    let newDataList = {
      product: Random.province().substring(0, 2),
      2015: Random.increment(100),
      2016: Random.increment(10),
      2017: Random.increment(10),
    };

    dataList.push(newDataList);
  }
  return dataList;
};

Mock.mock("/mock/test", mockData);
Mock.mock("/mock/dataset", mockData1);
